Dear all, |
Re: Runtime Issues with "richTextWithOle" function Have you tried with "richTextNoOle" ? Alain |
Re: Runtime Issues with "richTextWithOle" function adevicq - Wed Apr 20 09:19:14 EDT 2011 thanks for your help. As I said I need richTextWithOle, as otherwise you cannot check for strike-through markup. I could solve the problem in the meanwhile by using lower case buffers instead of a string to hold the result of my richTextWithOle calls. Suddenly everything worked fine ;) Best Regards, Alex |
Re: Runtime Issues with "richTextWithOle" function SystemAdmin - Wed Apr 20 09:41:04 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Runtime Issues with "richTextWithOle" function SystemAdmin - Wed Apr 20 09:41:04 EDT 2011
Yes, richTextNoOle(attr) looks like a winner here; but I think that's the same as richText(attr).
RichTextParagraph rtp
RichText rt
string Text = richTextWithOle(obj."Object Text")
bool HasStrike = false
for rtp in Text do
{ for rt in rtp do
{ if (rt.strikethrough)
{ HasStrike = true
break // don't bother looking further
}
}
}
if (HasStrike) then perhaps delete this object.
|
Re: Runtime Issues with "richTextWithOle" function llandale - Wed Apr 20 16:26:49 EDT 2011
Yes, richTextNoOle(attr) looks like a winner here; but I think that's the same as richText(attr).
RichTextParagraph rtp
RichText rt
string Text = richTextWithOle(obj."Object Text")
bool HasStrike = false
for rtp in Text do
{ for rt in rtp do
{ if (rt.strikethrough)
{ HasStrike = true
break // don't bother looking further
}
}
}
if (HasStrike) then perhaps delete this object.
Dear all,
RichTextParagraph rp;
RichText rt;
bool blnPossiblyRemoved = false;
bufObjectContent = richTextWithOle(obj."Object Heading") richTextWithOle(obj."Object Text");
setlower(bufObjectContent);
if(contains(bufObjectContent, "remove",0)!=-1)
{
blnPossiblyRemoved = true;
}
else if(contains(bufObjectContent, "delete",0)!=-1)
{
blnPossiblyRemoved = true;
}
else
{
for rp in stringOf(bufObjectContent) do
{
for rt in rp do
{
if(rt.strikethru)
{
blnPossiblyRemoved = true;
}
}
}
}
|
Re: Runtime Issues with "richTextWithOle" function SystemAdmin - Thu Apr 21 03:38:07 EDT 2011
Dear all,
RichTextParagraph rp;
RichText rt;
bool blnPossiblyRemoved = false;
bufObjectContent = richTextWithOle(obj."Object Heading") richTextWithOle(obj."Object Text");
setlower(bufObjectContent);
if(contains(bufObjectContent, "remove",0)!=-1)
{
blnPossiblyRemoved = true;
}
else if(contains(bufObjectContent, "delete",0)!=-1)
{
blnPossiblyRemoved = true;
}
else
{
for rp in stringOf(bufObjectContent) do
{
for rt in rp do
{
if(rt.strikethru)
{
blnPossiblyRemoved = true;
}
}
}
}
I am pretty sure that is not true (strike through being stored as OLE). Makes no sense. Not sure what the root cause was, but normally you can definitly get striked text using richText:
Object o = current
string someOLE ="{\\rtf1\\ansi\\ansicpg936\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}
\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs20{\\pict\\wmetafile8\\picw26\\pich26\\picwgoal3000\\pichgoal100
0100090000033a0000000000240000000000050000000b0200000000050000000c021a001a0024
000000430f2000cc00000001000100000000001a001a0000000000280000000100000001000000
010018000000000004000000c40e0000c40e000000000000000000000000ff00030000000000
}\\par
Hello {\\strike guys} {\\ul people}\\par
}
"
o."Object Text" = richText someOLE
string s2 = richTextWithOle o."Object Text"
print "RichTextWithOle:\n" s2 "\n"
string s1 = richText o."Object Text"
print "RichText:\n" s1 "\n\n"
RichText:
{\rtf1\ansi\ansicpg936\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}
\viewkind4\uc1\pard\lang1031\f0\fs20\objattph\'20\par
Hello \strike guys\strike0 \ul people\ulnone\par
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Runtime Issues with "richTextWithOle" function Mathias Mamsch - Thu Apr 21 06:22:55 EDT 2011
I am pretty sure that is not true (strike through being stored as OLE). Makes no sense. Not sure what the root cause was, but normally you can definitly get striked text using richText:
Object o = current
string someOLE ="{\\rtf1\\ansi\\ansicpg936\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}
\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs20{\\pict\\wmetafile8\\picw26\\pich26\\picwgoal3000\\pichgoal100
0100090000033a0000000000240000000000050000000b0200000000050000000c021a001a0024
000000430f2000cc00000001000100000000001a001a0000000000280000000100000001000000
010018000000000004000000c40e0000c40e000000000000000000000000ff00030000000000
}\\par
Hello {\\strike guys} {\\ul people}\\par
}
"
o."Object Text" = richText someOLE
string s2 = richTextWithOle o."Object Text"
print "RichTextWithOle:\n" s2 "\n"
string s1 = richText o."Object Text"
print "RichText:\n" s1 "\n\n"
RichText:
{\rtf1\ansi\ansicpg936\deff0{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}
\viewkind4\uc1\pard\lang1031\f0\fs20\objattph\'20\par
Hello \strike guys\strike0 \ul people\ulnone\par
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
But what I am saying is, that if you replace "richTextWithOle" with "richText" or "richTextNoOle" in my code, than it will not find any strike-through RTF parts using RichParagraphs. |
Re: Runtime Issues with "richTextWithOle" function SystemAdmin - Thu Apr 21 07:07:18 EDT 2011 NitPicks: your existing code creates a huge string for placement into the Buffer, put the parts in separately: bufObjectContent = create() bufObjectContent += richTextWithOle(obj."Object Heading") bufObjectContent += richTextWithOle(obj."Object Text") bla bla bal delete(bufObjectContent) Use tempStringOf() when retrieving the string for your loop. The "contains" command for strings is very suspect; it will not find "xdelete" for example. For this purpose you could perhaps retrieve the raw text and use regexp to search for delete and remove.
|
Re: Runtime Issues with "richTextWithOle" function SystemAdmin - Thu Apr 21 07:07:18 EDT 2011
It might be the right associative devil that haunted you: bufObjectContent = richTextWithOle(obj."Object Heading") richTextWithOle(obj."Object Text");
bufObjectContent = richTextWithOle( obj."Object Heading" richTextWithOle (obj."Object Text") );
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Runtime Issues with "richTextWithOle" function Mathias Mamsch - Thu Apr 21 10:46:26 EDT 2011
It might be the right associative devil that haunted you: bufObjectContent = richTextWithOle(obj."Object Heading") richTextWithOle(obj."Object Text");
bufObjectContent = richTextWithOle( obj."Object Heading" richTextWithOle (obj."Object Text") );
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Just to clear things up! richTextWithOle cannot be applied twice, since it will only take an Attr__ as a parameter, so no right associativity problem using richTextWithOle ... 'richText' however will take a string as a parameter and therefore be applied twice. So this code works for me:
RichTextParagraph rp;
RichText rt;
Object obj = current
Buffer b = create()
b = (richText obj."Object Heading") (richText obj."Object Text");
setlower b
for rp in stringOf(b) do {
for rt in rp do {
if(rt.strikethru) {
print "Found strike!"
}
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Runtime Issues with "richTextWithOle" function Mathias Mamsch - Thu Apr 21 10:58:24 EDT 2011
Just to clear things up! richTextWithOle cannot be applied twice, since it will only take an Attr__ as a parameter, so no right associativity problem using richTextWithOle ... 'richText' however will take a string as a parameter and therefore be applied twice. So this code works for me:
RichTextParagraph rp;
RichText rt;
Object obj = current
Buffer b = create()
b = (richText obj."Object Heading") (richText obj."Object Text");
setlower b
for rp in stringOf(b) do {
for rt in rp do {
if(rt.strikethru) {
print "Found strike!"
}
}
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
... b = richText(o."A") richText(o."B") is the same as: ... b = richText(o."A" richText(b."B")) ?? And that's because of that odd feature that parens around a single string parameter are ignored?
|
Re: Runtime Issues with "richTextWithOle" function llandale - Thu Apr 21 12:19:49 EDT 2011
That is exactly what I am saying. Note that the "." operator has precedence over concatenation. It is the same as calling string s = (o."A") ( richText (o."B") ) // string richText(string) perm is called! Buffer b = richText s
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|